package controler;
import javax.swing.event.ListSelectionListener;
import javax.swing.event.ListSelectionEvent;
import javax.swing.JList;

import model.Restaurant;

import template.AbstractListener;

import java.util.Observable;

public class SetMenuListener extends AbstractListener implements ListSelectionListener{
	
	private static final long serialVersionUID = 1L;
	
	public SetMenuListener(Observable obs){
		addModel(obs);
	}
	
	public void valueChanged(ListSelectionEvent evt){
		if(evt.getValueIsAdjusting() == false){
			JList list = (JList)evt.getSource();		
			Restaurant model = (Restaurant)getModel(0);
			model.setMenuSection((String)list.getSelectedValue());
		}
	}

}
